//
//  RMMOderYouHuiTableViewCell.m
//  Romomo
//
//  Created by puman on 16/10/12.
//  Copyright © 2016年 mazegong. All rights reserved.
//

#import "RMMOderYouHuiTableViewCell.h"

@implementation RMMOderYouHuiTableViewCell
{
    UILabel *_youHuiLabel;
    UILabel *_yanZhiLabel;
    UILabel *_memberCardLabel;
    UILabel *_priceLabel;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        NSArray *nameArray = @[@"优惠券抵扣:",@"颜值积分抵扣:",@"会员卡支付优惠:"];
        for (int i = 0; i < 3; i++) {
            UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 15 + kMaric * i, 2 * kHalf + kMaric, kMaric)];
            label.text = nameArray[i];
            label.textColor = COLORFROMCODE(0x9B9B9B, 1);
            label.font = kFont(14);
            [self.contentView addSubview:label];
            
            UILabel *priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(label.right, label.top, kScreenWideth - label.right - 15, kMaric)];
            priceLabel.textColor = COLORFROMCODE(0xF95B45 , 1);
            priceLabel.font = kFont(14);
            priceLabel.text = @"- ¥0";
            priceLabel.textAlignment = NSTextAlignmentRight;
            [self.contentView addSubview:priceLabel];
            if (i == 0) {
                _youHuiLabel = priceLabel;
            } else if (i == 1){
                _yanZhiLabel = priceLabel;
            } else {
                _memberCardLabel = priceLabel;
            }
        }
        UIView *lineLabel = [[UIView alloc] initWithFrame:CGRectMake(15, 90, kScreenWideth - 30, 1)];
        lineLabel.backgroundColor = COLORFROMCODE(0xEEEEEE, 1);
        [self.contentView addSubview:lineLabel];
        
        UILabel *labels = [[UILabel alloc] initWithFrame:CGRectMake(15, lineLabel.bottom, 100, 54)];
        labels.textColor = COLORFROMCODE(0x9B9B9B, 1);
        labels.font = kFont(14);
        labels.text = @"实付金额:";
        [self.contentView addSubview:labels];

        
        _priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(labels.right, labels.top, kScreenWideth - labels.right - 15, 54)];
        _priceLabel.textColor = COLORFROMCODE(0xF95B45 , 1);
        _priceLabel.font = kFont(14);
        _priceLabel.text = @"- ¥0";
        _priceLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_priceLabel];
        
    }
    return self;
}
- (void)setDic:(NSDictionary *)dic{
    _priceLabel.text = [NSString stringWithFormat:@"¥%@",dic[@"PAY_AMT"]];
    NSString *y = dic[@"FACE_ATM"];
    NSString *h = dic[@"VIP_ATM"];
    NSString *q = dic[@"VOUCHER_ATM"];
    _yanZhiLabel.text = [NSString stringWithFormat:@"- ¥%@",y.length == 0 ? @"0" : y];
    _youHuiLabel.text = [NSString stringWithFormat:@"- ¥%@",q.length == 0 ? @"0" : q];
    _memberCardLabel.text = [NSString stringWithFormat:@"- ¥%@",h.length == 0 ? @"0" : h];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
